//
//  ContractInfoGrabRootDataSource.m
//  Jyxt
//
//  Created by 刘日 on 17/5/17.
//  Copyright © 2017年 DaLian Rental Housing Management. All rights reserved.
//

#import "ContractInfoGrabRootDataSource.h"
#import "FormInputTableViewCell.h"
#import "PhotosTableViewCell.h"

@implementation ContractInfoGrabRootDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [@[@1, @2][section] integerValue];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *names = @[@"PhotosTableViewCell",@"FormInputTableViewCell"];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: names[indexPath.section]];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed: names[indexPath.section] owner: self options: nil] lastObject];
    }
    if (indexPath.section == 0) {
        ((PhotosTableViewCell *) cell).tableView = tableView;
    }
    if (indexPath.section == 1){
        FormInputTableViewCell *inputCell = (FormInputTableViewCell *)cell;
        [inputCell setData: @[@"合同编号" , @"备注信息"][indexPath.row] saveKeyPath: @[@"contractNo" , @"contractRemark"][indexPath.row]];
    }
    return cell;
}

@end
